import fileinput

# with fileinput.input(files="example.txt") as f:   # 1.不修改源文件
with fileinput.input(                               # 2.修改源文件
    files="example.txt", inplace=True, backup=".bak"
) as f:
    for line in f:
        print(line.replace("11", "111"), end="")
